package Model;

import java.sql.Connection;
import java.sql.*;
import java.util.*;

/**
 * Class to define a contact
 * with all its attributes
 * @author Johanna
 *
 */
public class Contact {
	
	/* Attributes */
	private String fname;
	private String lname;
	private String number;
	private String group;
	private String address;
	private String email;
	private String homepage;
	
	/**
	 * Constructor
	 */
	public Contact()
	{	
	}
	
	/**
	 * Constructor of a new contact
	 * @param newFname
	 * @param newLname
	 * @param newNumber
	 * @param newAddress
	 * @param newGroup
	 * @param newEmail
	 * @param newHomepage
	 */
	public Contact(String newFname, String newLname, String newNumber,  String newAddress, String newGroup,
			String newEmail, String newHomepage)
	{
		fname = newFname;
		lname = newLname;
		number = newNumber;
		group = newGroup;
		address = newAddress;
		email = newEmail;
		homepage = newHomepage;
	}
		
	public void setFname(String newFname)
    {    
		this.fname = newFname;
    }
	
	public void setLname(String newLname)
    {
		this.lname = newLname;
    }
	
	public void setNumber(String newNumber)
    {
		this.number = newNumber;
    }
	
	public void setGroup(String newGroup)
	{
		this.group = newGroup;
	}
	
	public void setAddress(String newAddress)
	{
		this.address = newAddress;
	}
	
	public void setEmail(String newEmail)
	{
		this.email = newEmail;
	}
	
	public void setHomepage(String newHomepage)
	{
		this.homepage = newHomepage;
	}
	
	public String getFname()
    {
		return this.fname;
    }
	
	public String getLname()
    {
		return this.lname;
	}

	public String getNumber()
    {
		return this.number;
	}
	
	public String getGroup()
	{
		return this.group;
	}
	
	public String getAddress()
	{
		return this.address;
	}
	
	public String getEmail()
	{
		return this.email;
	}
	
	public String getHomepage()
	{
		return this.homepage;
	}
	
	/**
	 * Method to get the information of the contact in a single string
	 */
	public String toString()
    {   
		String info;
        StringBuilder sb = new StringBuilder();
        sb.append(this.fname).append(";").append(this.lname).append(";").append(number).append(";").append(address)
        .append(";").append(group).append(";").append(email).append(";").append(homepage);
        
        info = sb.toString();
        
        return info;
    }
}
